# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=fprobe
pkgver=1.1
pkgrel=13
pkgdesc="libpcap-based tool that collect network traffic"
url="https://fprobe.sourceforge.net/"
arch="all"
license="GPL-2.0-or-later"
makedepends="libpcap-dev"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://downloads.sourceforge.net/fprobe/fprobe-$pkgver.tar.bz2
	fprobe-1.1-pidfile-sanity.patch
	fprobe-1.1-setgroups.patch
	$pkgname.initd
	$pkgname.confd"
options="!check"

prepare() {
	default_prepare
	update_config_sub
}

build() {
	CFLAGS="$CFLAGS -std=gnu89" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make
}

package() {
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="35fa4bedf2c615093b6637630322115e12f005bc43186b86c55c6bdc76ae5308dd31e1d05632e26e07a30fba88d76b9acc98632bee4f372edcf9df5da3e32210  fprobe-1.1.tar.bz2
429d863547901564abfbd4e9629213f517797a98024c78394f9e89242cf06fba640b3c969e9ef58361a51c2ce0b82e0d79759e92634e31ec51c7016351cb8770  fprobe-1.1-pidfile-sanity.patch
6433b39d6612581b393064385aa206313a2a359d2373fffb64463b748392eb64c69737d4dec55cdfa51a21c1c01f1a123fdddb344cd9faed23c79d64cad00dcb  fprobe-1.1-setgroups.patch
f934b0ffe79e2a9429ff6fe4505e9ee77a4a736765dfba1be29ba79d81535f77c54a01acd360c5ea873fe85ddd7e4fa56cb2db1fc8a48f978d10dc864e4ee14a  fprobe.initd
fd6e7cfc50d3962ab41f0109f87690b50d7b2852d5f613117421747c4451589f625a3a3a4405e20a57c2d56ef8a4c8659942564c02862e8906b5b75f56972bed  fprobe.confd"
